Repository navigation
cmake: function-visibility.txt entries for UpdatePriest, UpdatePeasant and UpdateMiller - #535
Merged
Conversation
…t and UpdateMiller sourcehold#534 gave the nine /GL units of sourcehold#515, sourcehold#516 and sourcehold#518 that had no entry in cmake/function-visibility.txt one, and left three for a follow-up: UpdatePeasant and UpdateMiller (sourcehold#533), and UpdatePriest, main's own unit. This adds the three, each at its address, its callees in address order. All three are on cmake/compiler-flags-gl.txt already (UpdatePriest was there before those PRs); that file stays as it is. With OPENSHC_FUNCTION_VISIBILITY_UNITS on, the members of every group leave the /GL list, among them the helpers in the group that holds hasUnitReachedDestination, so a /GL unit without an entry no longer sees them: in main e62246a's full build in that mode, the build the real builds below compare against, UpdatePriest reads 72.0% / 68.9%, UpdatePeasant 49.3% / 48.7% and UpdateMiller 51.7% / 46.2% (raw / normalised: reccmp_report.py's normalised figure ignores call and tail-jump targets and resolver addresses). UpdatePriest's entry names only callees that are already members of the group that holds hasUnitReachedDestination, as sourcehold#534's do. UpdatePeasant's and UpdateMiller's name members of that group and, each, one more /GL callee that is not in it: getDestination2EqualsGivenCoordinates for UpdatePeasant and standUpIfSeated for UpdateMiller. With the members alone they read 96.0% / 87.1% and 96.5% / 93.0% in an earlier full build of this branch with the option on (below). With that callee they read 100.0%, so it joins the group, and with the option on, CMake takes five more files off the /GL list: the three units, getDestination2EqualsGivenCoordinates and standUpIfSeated. Nothing else moves: getDestination2EqualsGivenCoordinates is called by UpdatePeasant only, and standUpIfSeated by UpdateMiller, standUpAllTribeUnits and updatePeasantSeatingAtBuilding (neither of the last two is on the /GL list or has an entry, so neither saw its body before or sees it now). No other function sees a body it did not see before. The three units' other /GL callees (setDestinationForUnit, resetUnitMovementState, clearHiddenFlagAndUpdatePosition, setWorkplaceBuildingEntryAsTarget, selectNewBlessingTarget, setUnitFacingDirectionTowardsTarget and the rest of their closures) stay opaque to them. Each caller-callee pair is measured as sourcehold#491's and sourcehold#534's were: the unit's file compiled with the callee files pasted in front of it, against the unit alone, quick_diff on main e62246a, with the data resolvers switched on by tools/reimplementation-control/enable_reimplemented_data.py and the function resolver of every .cpp in the build list by tools/reimplementation-helper/batch/enable_local_functions.py (locally, not committed). The callees tried are the group's members that the unit calls directly or through another member it calls (commitUnitLocation's callee setupUnitSharingCurrentTilePosition and, behind it, setupUnitSharingTileIDs, included), not callees reached only through functions outside the group; and, for UpdatePeasant and UpdateMiller, each /GL callee outside the group that they call, one at a time on top of the named members, pasted without its own callees unless it says "with its callees". A callee is listed when leaving it out of the set lowers the ratio; the listed set reads what the whole set reads. quick_diff is stricter than reccmp about register names; the real builds read the units at 100.0%. - UpdatePriest: 0.7534 alone, 0.9986 with its 5. Left out, makeUnitStopWalkingByClearingPathProgressState reads 0.9891, IncrementAndOptionalUpdateAVValueRelated 0.8859, checkIfCitizenUnitIsAliveBasedOnState 0.9510, hasUnitReachedDestination 0.9680, changeDestinationByAmount 0.9850. commitUnitLocation, its callee setupUnitSharingCurrentTilePosition and, behind it, setupUnitSharingTileIDs change nothing. - UpdatePeasant: 0.5329 alone, 0.9941 with its 3. Left out, checkIfCitizenUnitIsAliveBasedOnState reads 0.5880, getDestination2EqualsGivenCoordinates 0.9725, hasUnitReachedDestination 0.9684. Outside the group, on top of the two members, clearHiddenFlagAndUpdatePosition (with its callees) and setDestinationForUnit change nothing. - UpdateMiller: 0.5531 alone, 0.9973 with its 13. Left out, getBuildingResourceAmountByUid reads 0.9722, setupUnitSharingTileIDs 0.9947, standUpIfSeated 0.9913, sitDownIfStanding 0.9953, IncrementAndOptionalUpdateAVValueRelated 0.8442, ConsiderHavingABreakNowUnk 0.9914, SetStateToFreetimeWalking 0.9707, ComputeGoodsProduced 0.9661, checkIfCitizenUnitIsAliveBasedOnState 0.8008, hasUnitReachedDestination 0.9593, setupUnitSharingCurrentTilePosition 0.9947, UpdateWorker_ConsiderTakingABreakUnk 0.9914, commitUnitLocation 0.9947. makeUnitStopWalkingByClearingPathProgressState changes nothing. Outside the group, on top of the twelve members, resetUnitMovementState (with its callees), setDestinationForUnit, setWorkplaceBuildingEntryAsTarget, addResourceToStockpile, buildingIsAccessible, updateBuildingSignpostCounter and getStorageBuildingForResourceTypeAndAmount change nothing; the last four are members of other groups, so with the option on they are off the /GL list already, and naming one would merge two groups. With every .cpp of main as the build list, cmake/function-visibility-units.py makes 25 wrapper units holding 155 source files (150 before): the three units and the two callees join the group that holds hasUnitReachedDestination, and no other file changes group. CMake reads this file only with the option on, so the default build is unchanged. Real builds on main e62246a, BUILD_OK and 0 failures each: - full, option on: every .cpp of main with all function and data resolvers on (the 3 files that don't compile there left out: findBestAttackTileByPathCost, resetTileAndClearMoat, TransformAndRenderPercentage), 3,036 files and 3,054 functions, against main e62246a built the same way. Two full builds of the branch's side: one with the three entries without getDestination2EqualsGivenCoordinates and standUpIfSeated (UpdatePriest's as it is now), which reads UpdatePeasant 96.0% / 87.1%, UpdateMiller 96.5% / 93.0% and UpdatePriest 100.0% / 100.0%; and this change, which reads the three 100.0% / 100.0%. Against main nothing else reads differently in either. - small, both modes: main's /GL list, every .cpp that reads Unit::disappearFadeAlphaCountdown, the twelve units of sourcehold#515, sourcehold#516 and sourcehold#518 (nine in sourcehold#534, three with an entry before it) and these three with their callee closures, standUpAllTribeUnits and updatePeasantSeatingAtBuilding, and every file of a group that touches them, 494 files and 504 functions. All fifteen units read 100.0% / 100.0% in both modes. UpdateFireBallistaBuilding: with the option off, where this file is not read, 100.0% / 100.0% with the 494 files and 99.6% / 95.5% with 492 (without standUpAllTribeUnits and updatePeasantSeatingAtBuilding), so its reading changes with the set of files built; with the option on, 99.6% / 95.5% with the 494 files, and main was not built with those files and the option on, so that case is not settled. It reads 100.0% / 100.0% in both full builds, this change's and main's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gynt
approved these changes
Dec 1, 2026
This was referenced Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#534 gave the nine
/GLunits of #515, #516 and #518 that had no entry incmake/function-visibility.txtone, and left three for this follow-up: UpdatePeasant and UpdateMiller (#533), and UpdatePriest. All three are oncmake/compiler-flags-gl.txtalready; UpdatePriest was there before those PRs and is in none of them, and it is here because #534 left it and its entry is of the same kind as the others. One commit,cmake/function-visibility.txtonly: an entry for each of the three at its address, its callees in address order. No change to a.cpp, a header orcmake/compiler-flags-gl.txt.Units::UpdatePeasantcheckIfCitizenUnitIsAliveBasedOnState,getDestination2EqualsGivenCoordinates,hasUnitReachedDestinationUnits::UpdateMillergetBuildingResourceAmountByUid,setupUnitSharingTileIDs,standUpIfSeated,sitDownIfStanding,IncrementAndOptionalUpdateAVValueRelated,ConsiderHavingABreakNowUnk,SetStateToFreetimeWalking,ComputeGoodsProduced,checkIfCitizenUnitIsAliveBasedOnState,hasUnitReachedDestination,setupUnitSharingCurrentTilePosition,UpdateWorker_ConsiderTakingABreakUnk,commitUnitLocationUnits::UpdatePriestmakeUnitStopWalkingByClearingPathProgressState,IncrementAndOptionalUpdateAVValueRelated,checkIfCitizenUnitIsAliveBasedOnState,hasUnitReachedDestination,changeDestinationByAmountRaw / normalised reccmp figures with the option on, from the full builds below; "before" is main e62246a built the same way. Normalised is main's
reccmp_report.pyfigure, which ignores call and tail-jump targets and resolver addresses. With the option off, the default build, all three read 100.0% in this branch's small build.What the entries name
With the option on, every caller and callee joined by entries ends up in one group, each group is built as one wrapper unit that
#includes its members (without/GL), and the members leave the/GLlist. The unit helpers that main's unit entries name are in one such group, the group that holdshasUnitReachedDestination. A/GLunit without an entry stays on the/GLlist but no longer sees them, which is why the three read 49.3% to 72.0%.UpdatePriest's entry names only callees that are already members of the group that holds
hasUnitReachedDestination, as #534's do. UpdatePeasant's and UpdateMiller's name members of that group and, each, one more/GLcallee that is not in it:getDestination2EqualsGivenCoordinatesfor UpdatePeasant andstandUpIfSeatedfor UpdateMiller. With the members alone they read 96.0% / 87.1% and 96.5% / 93.0% in an earlier full build of this branch with the option on (in Measured below); with that callee they read 100.0%. So it joins the group, and with the option on, CMake takes five more files off the/GLlist: the three units,getDestination2EqualsGivenCoordinatesandstandUpIfSeated.Nothing else moves, and the full builds below show it.
getDestination2EqualsGivenCoordinatesis called by UpdatePeasant only.standUpIfSeatedis called by UpdateMiller,standUpAllTribeUnitsandupdatePeasantSeatingAtBuilding; neither of the last two is on the/GLlist or has an entry, so neither saw its body before or sees it now. No other function sees a body it didn't see before. The three units' other/GLcallees (setDestinationForUnit,resetUnitMovementState,clearHiddenFlagAndUpdatePosition,setWorkplaceBuildingEntryAsTarget,selectNewBlessingTarget,setUnitFacingDirectionTowardsTargetand the rest of their closures) stay out of the group and opaque to them.Each caller-callee pair is measured as #491's and #534's were: the unit's file compiled with the callee files pasted in front of it, against the unit alone (
quick_diff, on main e62246a, with the resolvers as in the setup line below). The callees tried are the group's members that the unit calls directly or through another member it calls (commitUnitLocation's calleesetupUnitSharingCurrentTilePositionand, behind it,setupUnitSharingTileIDs, included), not callees reached only through functions outside the group; and, for UpdatePeasant and UpdateMiller, each/GLcallee outside the group that they call, one at a time on top of the named members, pasted without its own callees unless the text says "with its callees". A callee is named when leaving it out of the set lowers the ratio, and the named set reads what the whole set reads:makeUnitStopWalkingByClearingPathProgressState(UpdateMiller), andcommitUnitLocation, its calleesetupUnitSharingCurrentTilePositionand, behind it,setupUnitSharingTileIDs(UpdatePriest). They are in the group anyway, through other entries.clearHiddenFlagAndUpdatePosition(with its callees) andsetDestinationForUnit(UpdatePeasant);resetUnitMovementState(with its callees),setDestinationForUnit,setWorkplaceBuildingEntryAsTarget,addResourceToStockpile,buildingIsAccessible,updateBuildingSignpostCounterandgetStorageBuildingForResourceTypeAndAmount(UpdateMiller). The last four are members of other groups, so with the option on they are off the/GLlist already, and naming one would merge two groups.quick_diffis stricter than reccmp about register names; the real builds read each of the three at 100.0%.Measured.
Stronghold Crusader.exe(3bb0a8c1…5387ac5a), both resolver sets enabled locally (not committed: the data resolvers withtools/reimplementation-control/enable_reimplemented_data.py, the function resolver of every.cppin the build withtools/reimplementation-helper/batch/enable_local_functions.py), and sourcehold's reccmp (a86aceb03) with--resolve-wrapped-calls --ignore-security-cookie..cppof main but the 3 in the note below, with all function and data resolvers on, 3,036 files and 3,054 functions, BUILD_OK and 0 failures each: main e62246a, and two full builds of the branch's side. The first of those had the three entries withoutgetDestination2EqualsGivenCoordinatesandstandUpIfSeated(UpdatePriest's as it is now): UpdatePeasant 96.0% / 87.1%, UpdateMiller 96.5% / 93.0%, UpdatePriest 100.0% / 100.0%. The second is this branch. Against main, nothing on main reads differently in either: the only changes are the three units, as in the table for the second. Average 99.24% for this branch against 99.20% for main.cmake/function-visibility-units.pymakes 25 wrapper units holding 155 source files (150 on main): the three units and the two callees join the group that holdshasUnitReachedDestination, and no other file changes group./GLfile of main, every.cppthat readsUnit::disappearFadeAlphaCountdown, the twelve units of Reimplement UpdateCamel, UpdateLady, UpdateMother and UpdateFireEater from gynt's units branch, under /GL (100%) #515, Reimplement UpdateChild, UpdateWheatFarmer, UpdateCrossbowman, UpdateLadderman, UpdateTunneler and UpdateFireThrower from gynt's units branch, under /GL (100%) #516 and Reimplement UpdateArabianArcher and UpdateCrusaderArcher from gynt's units branch, under /GL (100%) #518 (nine in cmake: function-visibility.txt entries for the /GL units of #515, #516 and #518 #534, three with an entry before it) and these three with their callee closures,standUpAllTribeUnitsandupdatePeasantSeatingAtBuilding(the other callers ofstandUpIfSeated), and every file of a function-visibility group that touches them: 494 files, 504 functions, 0 failures in both modes.UpdateFireBallistaBuilding: with the option off, wherecmake/function-visibility.txtis not read, it reads 100.0% / 100.0% with the 494 files and 99.6% / 95.5% with 492 (withoutstandUpAllTribeUnitsandupdatePeasantSeatingAtBuilding), so its reading changes with the set of files built. With the option on it reads 99.6% / 95.5% with the 494 files; main was not built with those files and the option on, so that case is not settled. It reads 100.0% / 100.0% in both full builds, this branch's and main's.cmake/function-visibility.txtonly insideif(OPENSHC_FUNCTION_VISIBILITY_UNITS)(CMakeLists.txtline 148): the file is registered as a configure dependency and handed tocmake/function-visibility-units.pythere and nowhere else, so with the option off this branch builds exactly what main builds..cppor header change, sostyle_lint.pyhas nothing to check.findBestAttackTileByPathCost,resetTileAndClearMoat,TransformAndRenderPercentage). cmake: function-visibility.txt entries for the /GL units of #515, #516 and #518 #534's text listed 12; the other nine compile on this main and are in the full builds. The builds above left the three out, with their resolvers off. This PR doesn't touch them.Other PRs
getBuildingResourceAmountByUid); the lines are separate, keep them all.UpdateMiller.cpp,UpdatePeasant.cppandUpdatePriest.cpp.🤖 Generated with Claude Code